How can I make `new[]` default-initialize the array of primitive types?

Posted by sharptooth on Stack Overflow See other posts from Stack Overflow or by sharptooth
Published on 2010-03-18T07:47:36Z Indexed on 2010/03/18 7:51 UTC
Read the original article Hit count: 213

Filed under:
|
|

Every now and then I need to call new[] for built-in types (usually char). The result is an array with uninitialized values and I have to use memset() or std::fill() to initialize the elements.

How do I make new[] default-initialize the elements?

© Stack Overflow or respective owner

Related posts about c++

Related posts about initialization